import request from "@/utils/request";

const api_name = '/chapter'

export default {
    // 根据课程id获取课程大纲信息
    getTreeList(courseId) {
        return request({
            url: `${api_name}/treelist/${courseId}`,
            method: 'get'
        })
    },
    // 添加课程
    addChapter(chapter) {
        return request({
            url: `${api_name}`,
            method: 'post',
            data: chapter
        })
    },
    // 根据id获取章节信息
    getChapter(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'get'
        })
    },
    // 更新课程章节
    updateChapter(chapter) {
        return request({
            url: `${api_name}/${chapter.id}`,
            method: 'put',
            data: chapter
        })
    },
    // 根据id删除课程章节
    delChapter(id) {
        return request({
            url: `${api_name}/${id}`,
            method: 'delete'
        })
    }
}